Understanding Admission Denied if alive with ISensor::GetState() and ISensor::GetProperty()
نوشته شده توسط : isweek.com

Understanding Admission Denied if alive with ISensor::GetState() and ISensor::GetProperty()

In endure week’s blog column we provided best convenance advice for fiber optic sensor Accompaniment administration in Location Sensors. At the basal of that column we acknowledgment that SENSOR_STATE_ACCESS_DENIED is aloof and should alone be acclimated by the Platform. As a follow-on column we capital to briefly dig into an affair that some barter accept appear accompanying to SENSOR_STATE_ACCESS_DENIED. As mentioned aloft - this blog affair is in fact based on a catechism from one of our customers. The chump in question, a disciplinarian developer, had noticed that if admission was denied to their sensor in the Location and Other Sensors Control Panel that they could get altered answers for Sensor Accompaniment depending on area they asked the catechism in the Sensor API.

Let’s yield the afterward scenario: 1. You accept a Sensor Accessory active on your machine. 2. You apperceive the accessory is currently advertisement a Sensor Accompaniment of SENSOR_STATE_READY 3. You accessible the Location and Other Sensors Control Panel. 4. You attenuate admission to your sensor device. Now actuality is area it can get interesting. If you alarm the afterward two methods you ability apprehend to get the aforementioned acknowledgment for the accompaniment of your sensor ? but you don’t: Calling ISensor::GetState() will acknowledgment the accompaniment of SENSOR_STATE_ACCESS_DENIED. Calling ISensor::GetProperty() with an ascribe Acreage Key of SENSOR_PROPERTY_STATE will acknowledgment SENSOR_STATE_READY. The disciplinarian accomplice mentioned aloft asked the question: Why? To acknowledgment this catechism we charge to briefly altercate area permissions are managed in the Sensor API. I should agenda that this will be a actual abrupt altercation on permissions management. We apprehend to accept added posts advancing that dig into the accountable of permissions in greater detail.

A abrupt addition into Permissions: In an beforehand blog column we provided this diagram as an archetype for how the Sensor Belvedere is designed: industry sourcing As you can see in this diagram the Sensors Class Extension and the Sensor API both allocution to the Location and Other Sensors Control Panel. The Sensors Class Extension alive with the Location and Other Sensors Control Panel accommodate the permissions basement for the Platform. If you change permissions in the Location and Other Sensors Control Panel the Sensor API, alive with the Sensor Class Extension, will stop acceding admission to that device. In this way the Sensor Class Extension serves as a kind-of в??gate keeperв?? for accessing sensor devices. In the archetype book aloft if you asked the Sensor API for the sensors accompaniment via a alarm to ISensor::GetState() you were about allurement the belvedere what accompaniment it accepted the sensor to be in. In this case, because the belvedere knows the sensor is Admission Denied, it will acknowledgment a accompaniment of SENSOR_STATE_ACCESS_DENIED. Because permissions are managed abstracted from accessory backdrop the belvedere in this case needs abandon the Sensor Accompaniment from the accessory and acknowledgment SENSOR_STATE_ACCESS_DENIED. Alternatively, if you accomplish a alarm to ISensor::GetProperty() for acreage SENSOR_PROPERTY_STATE you are requesting a acreage anon from the sensor.

The Sensor Device, which does not apperceive the belvedere has denied admission to the Sensor, will acknowledgment its accepted Sensor State. We accept that this dash in Belvedere behavior has acquired some confusion. We will appraise this in the future. So which adjustment should you use to admission Sensor State? The advice we accept for appliance developers is that if you charge admission to Sensor Accompaniment again appeal the accompaniment from ISensor::GetState(). Calling ISensor::GetState() will assure that you accept the a lot of authentic representation of Accompaniment from a Sensor Belvedere perspective.(buy sensors)





:: بازدید از این مطلب : 113
|
امتیاز مطلب : 0
|
تعداد امتیازدهندگان : 0
|
مجموع امتیاز : 0
تاریخ انتشار : چهار شنبه 26 شهريور 1393 | نظرات ()
مطالب مرتبط با این پست
لیست
می توانید دیدگاه خود را بنویسید


نام
آدرس ایمیل
وب سایت/بلاگ
:) :( ;) :D
;)) :X :? :P
:* =(( :O };-
:B /:) =DD :S
-) :-(( :-| :-))
نظر خصوصی

 کد را وارد نمایید:

آپلود عکس دلخواه: